home *** CD-ROM | disk | FTP | other *** search
/ Champak 140 / (Vol 140) Sep 19 2011.iso / Games / world-wars.swf / scripts / DefineSprite_376 / frame_1 / DoAction.as
Text File  |  2011-09-19  |  3KB  |  135 lines

  1. function setArmy()
  2. {
  3.    if(army._currentframe == 1)
  4.    {
  5.       _parent.ARMY = 1;
  6.    }
  7.    if(army._currentframe == 2)
  8.    {
  9.       _parent.ARMY = 2;
  10.    }
  11.    if(army._currentframe == 3)
  12.    {
  13.       _parent.ARMY = 3;
  14.    }
  15. }
  16. function resetPlayers()
  17. {
  18.    var _loc2_ = 2;
  19.    while(_loc2_ <= 8)
  20.    {
  21.       this["p" + _loc2_].gotoAndStop(1);
  22.       _loc2_ = _loc2_ + 1;
  23.    }
  24. }
  25. function rollButton(mc)
  26. {
  27.    mc.onRollOver = function()
  28.    {
  29.       this.gotoAndStop(2);
  30.    };
  31.    mc.onRollOut = mc.onReleaseOutside = function()
  32.    {
  33.       this.gotoAndStop(1);
  34.    };
  35. }
  36. rollButton(PLAY_BTN);
  37. rollButton(MUSIC_BTN_ON);
  38. rollButton(MUSIC_BTN_OFF);
  39. rollButton(HELP_BTN);
  40. PLAY_BTN.onRelease = function()
  41. {
  42.    _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  43.    _parent.OUTRO.gotoAndPlay(2);
  44. };
  45. HELP_BTN.onRelease = function()
  46. {
  47.    if(_parent.HELP_MC._currentframe == 1)
  48.    {
  49.       _parent.HELP_MC.gotoAndPlay(2);
  50.       _global.SOUNDS.playSound("okno help open.wav");
  51.       _parent.HELP_MC._visible = true;
  52.    }
  53. };
  54. MUSIC_BTN_ON._visible = !_global.ARE_SOUNDS;
  55. MUSIC_BTN_OFF.onRelease = function()
  56. {
  57.    _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  58.    this._visible = false;
  59.    MUSIC_BTN_ON.gotoAndStop(2);
  60.    MUSIC_BTN_ON._visible = true;
  61.    _global.ARE_SOUNDS = false;
  62.    _global.SOUNDS.killSoundtrack();
  63. };
  64. MUSIC_BTN_ON.onRelease = function()
  65. {
  66.    _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  67.    this._visible = false;
  68.    MUSIC_BTN_OFF.gotoAndStop(2);
  69.    MUSIC_BTN_OFF._visible = true;
  70.    _global.ARE_SOUNDS = true;
  71.    _global.SOUNDS.menuSoundtrack();
  72. };
  73. army.gotoAndStop(_parent.ARMY);
  74. nn.onRelease = function()
  75. {
  76.    _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  77.    var _loc2_ = army._currentframe + 1;
  78.    if(_loc2_ > 3)
  79.    {
  80.       _loc2_ = 1;
  81.    }
  82.    army.gotoAndStop(_loc2_);
  83.    setArmy();
  84. };
  85. pp.onRelease = function()
  86. {
  87.    _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  88.    var _loc2_ = army._currentframe - 1;
  89.    if(_loc2_ < 1)
  90.    {
  91.       _loc2_ = army._totalframes;
  92.    }
  93.    army.gotoAndStop(_loc2_);
  94.    setArmy();
  95. };
  96. nn.onRollOver = pp.onRollOver = function()
  97. {
  98.    this.gotoAndStop(2);
  99. };
  100. nn.onRollOut = nn.onReleaseOutside = pp.onRollOut = pp.onReleaseOutside = function()
  101. {
  102.    this.gotoAndStop(1);
  103. };
  104. this["p" + _parent.PL].gotoAndStop(2);
  105. var CHOSEN = this["p" + _parent.PL];
  106. var i = 2;
  107. while(i <= 8)
  108. {
  109.    this["p" + i].i = i;
  110.    this["p" + i].onRelease = function()
  111.    {
  112.       _global.SOUNDS.playSound("Click- g┼éo┼¢niejszy.wav");
  113.       resetPlayers();
  114.       CHOSEN.gotoAndStop(1);
  115.       CHOSEN = this;
  116.       this.gotoAndStop(2);
  117.       _parent.PL = this.i;
  118.    };
  119.    this["p" + i].onRollOver = function()
  120.    {
  121.       if(CHOSEN != this)
  122.       {
  123.          this.gotoAndStop(2);
  124.       }
  125.    };
  126.    this["p" + i].onRollOut = this["p" + i].onReleaseOutside = function()
  127.    {
  128.       if(CHOSEN != this)
  129.       {
  130.          this.gotoAndStop(1);
  131.       }
  132.    };
  133.    i++;
  134. }
  135.